package com.cskaoyan.controller;

import com.cskaoyan.bean.PO.MarketFeedback;
import com.cskaoyan.bean.common.BaseRespVo;
import com.cskaoyan.service.WxFeedbackService;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.session.Session;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.validation.ValidationUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author linhanxin
 * @date 2022/8/18.
 */
@RestController
@RequestMapping("wx/feedback")
public class WxFeedbackController {
    @Autowired
    WxFeedbackService wxFeedbackService;

    @RequestMapping("submit")
    public BaseRespVo feedbackSubmit(@RequestBody MarketFeedback marketFeedback) {
        Session session = SecurityUtils.getSubject().getSession();
        Integer userId = (Integer) session.getAttribute("userId");
        String username = (String) session.getAttribute("username");
        wxFeedbackService.feedbackSubmit(marketFeedback,userId,username);
        return BaseRespVo.ok();
    }
}
